package com.sky.myapplication.kotlin.kotlinActivity

import android.os.Bundle
import android.util.TypedValue
import androidx.appcompat.app.AppCompatActivity
import androidx.viewpager.widget.PagerTabStrip
import androidx.viewpager.widget.ViewPager
import com.sky.myapplication.R
import com.sky.myapplication.kotlin.kotlinAdapter.MainPageAdapter

/**
 * @Author: Minxp
 * @UpdateDate: 2021/7/7 0007
 * @Description: ViewPage
 */
class ViewPageKotlinActivity: AppCompatActivity() {
    lateinit var vp_body: ViewPager
    lateinit var pts_title: PagerTabStrip

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_view_page)

        initView()
        initData()
    }

    fun initView(){
        vp_body = findViewById(R.id.vp_body)
        pts_title = findViewById(R.id.pts_title)
    }

    fun initData(){
        pts_title.setTextColor(resources.getColor(R.color.design_default_color_on_surface))
        pts_title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18.0f)

        var data = ArrayList<String>()

        for (index in 1..5){
            data.add("第"+(index))
        }

        vp_body.adapter = MainPageAdapter(this, data)
    }
}